<?php
// 创建server对象 类型为SWOOLE_SOCK_UDP
$serv = new Swoole\Server('127.0.0.1', 9528, SWOOLE_PROCESS, SWOOLE_SOCK_UDP);
// 监听数据接受
$serv->on('Packet',function ($serv, $data, $clienInfo){
    echo "recv data from({$clienInfo['address']}:{$clienInfo['port']}): {$data}";
    $serv->sendto($clienInfo['address'], $clienInfo['port'], "server:{$data}");
});
// 启动服务
$serv->start();